package com.zhongyu.boot;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.annotation.RabbitListeners;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RabbitListener(queuesToDeclare = {@Queue(name="item_direct_queue02")})
public class ConsumerHandler {

    @RabbitHandler
    public void handleMessage01(@Payload String body){
        System.out.println("第一个handle方法:"+body);
    }

    @RabbitHandler
    public void handleMessage02(@Payload Map map){
        System.out.println("第二个handle方法:"+map);
    }


}
